package top.tagao.yygh.task.scheduled;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import top.tagao.yygh.common.rabbit.constant.MqConst;
import top.tagao.yygh.common.rabbit.service.RabbitService;

/**
 * @author fu-xiao-liu
 * @Date 2022/3/16 16:51
 */

@Component
@EnableScheduling
public class ScheduledTask {

    @Autowired
    private RabbitService rabbitService;

    @Scheduled(cron = "0 0 8 * * ?")
    public void task() {
        System.out.println("定时任务 ");
        rabbitService.sendMessage(MqConst.EXCHANGE_DIRECT_TASK, MqConst.ROUTING_TASK_8, "");
    }
}
